<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('用户资金管理')" />
</head>
<body>
<div class="main-content">
    <form id="form-user-add" class="form-horizontal">
        <input type="hidden" id="userId" name="userId" th:value="${user.userId}">
        <input type="hidden" id="loginName" name="loginName" th:value="${user.loginName}">
        <table class="table table-hover">
            <thead>
            <tr>
                <th class="bs-checkbox " style="width: 36px; " data-field="0" tabindex="0">
                    <!--					<div class="th-inner "><input name="btSelectAll" type="checkbox"></div>-->
                    <!--					<div class="fht-cell"></div>-->
                </th>
                <th data-field="freezeAmount" tabindex="0"><div class="th-inner ">冻结金额</div><div class="fht-cell"></div></th>
                <th data-field="createTime" tabindex="0"><div class="th-inner ">冻结时间</div><div class="fht-cell"></div></th>
                <th data-field="remark" tabindex="0"><div class="th-inner ">冻结原因</div><div class="fht-cell"></div></th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="sysUserFreezeAmount : ${sysUserFreezeAmounts}">
                <td>
                    <input type="checkbox" name="channelRadios" th:value="${sysUserFreezeAmount.freezeId}">
                </td>
                <td th:text="${sysUserFreezeAmount.freezeAmount}"></td>
                <td th:text="${sysUserFreezeAmount.createTime}"></td>
                <td th:text="${sysUserFreezeAmount.remark}"></td>
            </tr>
            </tbody>
            <button class="btn btn-success btn-sm" id="unfreeze">批量解冻</button>
        </table>

        <p>可用余额：[[*{sysUserAccount.balance}]]</p>
        <p>冻结余额：[[*{sysUserAccount.freezeBalance}]]</p>
        <div class="row" style="width: 500px">
            <div class="col-sm-6" style="width: 500px">
                <div class="form-group">
                    <div class="col-sm-8">
                        <div class="radio-box" th:each="dict : ${@dict.getType('sys_edit_account_type')}">
                            <input type="radio" name="editAccountType" th:value="${dict.dictValue}">
                            <label th:for="${dict.dictLabel}" th:text="${dict.dictLabel}"></label>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <p>金额：<input type="text" class="form-control" id="edit-amount" style="width: 200px"></p>
        <p>备注：<input type="text" class="form-control" id="edit-remark" style="width: 200px"></p>
    </form>
</div>

<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "system/user";
    var userRoles = [[${userRoles}]]


    /* 提交 */
    function submitHandler(index, layero){
        // var rows = $.table.selectFirstColumns();
        var userChannelRate1= $('input:radio[name="channelRadios"]:checked').parent().next().next().next().children("input").val();
        var userChannelRate2= $('input:radio[name="channelRadios"]:checked').parent().next().next().next().next().children("input").val();
        var userChannelFee= $('input:radio[name="channelRadios"]:checked').parent().next().next().next().next().next().children("input").val();
        var data = { "userId": $("#userId").val(), "channelId": $('input:radio[name="channelRadios"]:checked').val(),"userChannelRate1": userChannelRate1,"userChannelRate2": userChannelRate2,"userChannelFee": userChannelFee};
        $.ajax({
            type: "POST",
            url: prefix + '/editUserChannel' ,
            data: data ,
            async: false,
            success: function (data) {
                if (data.code==0) {
                    $.modal.confirm("操作成功;是否退出此页面", function () {
                        var index = parent.layer.getFrameIndex(window.name);
                        $.modal.close(index);
                    });
                }else {
                    $.modal.msgError(data.msg);
                }
            },
            error: function () {
                $.modal.msgError("未知错误,请重试");
            }
        })
    }


</script>
</body>
</html>
